package com.jffccloud.auth.web;

import com.jffccloud.auth.model.SysUser;
import com.jffccloud.auth.service.UserService;
import com.jffccloud.common.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

@RestController
@Api(value = "Web-AuthUserController", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class UserController extends BaseController<UserService,SysUser> {

    @GetMapping(value = "/get")
    @ApiOperation(httpMethod = "GET", value = "获取用户信息")
    public String getUser(){
        return "{username:'admin'}";
    }

    @GetMapping("/user")
    public Principal user(Principal user){
        return user;
    }
}
